#include "../apue.h"
#include <unistd.h>
#include <sys/utsname.h>

#define HOST_NAME_MAX 64

int main(void)
{
    struct utsname up;
    uname(&up);

    printf("struct utsname: \n");
    printf("sysname: %s\n", up.sysname);
    printf("nodename: %s\n", up.nodename);
    printf("release: %s\n", up.release);
    printf("version(rel): %s\n", up.version);
    printf("machine: %s\n", up.machine);

    char host[HOST_NAME_MAX];

    if (gethostname(host, HOST_NAME_MAX) == -1)
        err_sys("gethostname failed");

    printf("hostname: %s\n", host);

    return 0;
}


